from flask import Flask
from config import Config
from extensions import db
from api import api
from celery_app import create_celery_app

def create_app():
    app = Flask(__name__)
    app.config.from_object(Config)

    # 初始化扩展
    db.init_app(app)
    
    # 注册蓝图
    app.register_blueprint(api, url_prefix='/api')
    
    # 初始化 Celery
    celery = create_celery_app(app)
    app.celery = celery
    
    return app

app = create_app()
